<extend name="Base/common"/>
<block name="style">
<style type="text/css">
	.head{
		width:100%;
		height:100%;
		padding-top: 5px;
	}
	.formtijiao{
		width:93%;
		height:100%;
		margin:auto; 

	}
	label{
		display: block;
		height:33px;
        margin-top: 5px;
	}
	label input{
		width:68%;
		float: right;
	}
	label img{
		width:68%;
        height:97%;
		float: right;
		border-radius: 3px 3px;
        border:1px dashed #999;
		margin-top: -20px;
	}
   
</style>
</block>
<block name="body">

		<form class="formtijiao" method="post" action="">
			<!-- <label style="height:27.5%;">
				身份证正面照：
				<div class="up">
	                <input type="hidden" name="front_pic">
	                <i class="btn_ph"></i>
	                <img class="previewi"  src="__IMG__/idcard/front.png">
	            </div>
			</label> -->

            <label>
                姓名：
                <input type="text" name="name">
            </label>

			<label>
				手机号码：
				<input type="text" name="phone">
			</label>
			<input class="login-btn" style="background:#FF3030" type="submit" style="margin-top:13px;" value="提交">
			
		</form>

</if>
	



	


</block>



<block name="script">
<script>
wx.config({
    debug: false,
    appId: '{$weixinconfig.appId}',
    timestamp: '{$weixinconfig.timestamp}',
    nonceStr: '{$weixinconfig.nonceStr}',
    signature: '{$weixinconfig.signature}', 
    jsApiList: [
        'chooseImage',
        'previewImage',
        'uploadImage',
        'downloadImage',
        'getLocalImgData'
    ]
});
wx.ready(function () {
// 5.1 拍照、本地选图
    var images = {
        localId: [],
        serverId: []
    };

// 上传图片
    $(".up").click(function(){ 
        var path='';
        var that =$(this);
        images.localId = [];
        wx.chooseImage({
            count: 1, // 默认9
            sizeType: ['compressed'], // 可以指定是原图还是压缩图，默认二者都有
            sourceType: [ 'camera'],
            // sourceType: [ 'camera','album'], // 可以指定来源是相册还是相机，默认二者都有 'album',
            success: function (res) {  
                images.localId = res.localIds;
                if (images.localId.length == 0) {
                    alert('请先使用 chooseImage 接口选择图片');
                    return;
                }
                if(images.localId.length > 1) {
                    alert('目前仅支持单张图片上传,请重新上传');
                    images.localId = [];
                    return;
                }
                var i = 0, length = images.localId.length;
                images.serverId = [];
                function upload() {
                    wx.uploadImage({
                        localId: images.localId[i],
                        success: function (res) {
                            i++;
                            that.find('img.previewi').attr('src',images.localId[0]);
                            images.serverId.push(res.serverId);
                            that.find('input[type=hidden]').val(images.serverId[0]);
                            if (i < length) {
                                upload();
                            }
                        },
                        fail: function (res) {
                            alert(JSON.stringify(res));
                        }
                    });
                }
                upload();
            }
        });


        



    });
});


    </script>

</block>